/*
 * This file is part of Espruino, a JavaScript interpreter for Microcontrollers
 *
 * Copyright (C) 2024 Gordon Williams <gw@pur3.co.uk>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * ----------------------------------------------------------------------------
 * This file is designed to be parsed during the build process
 *
 * Contains Custom Fonts
 * ----------------------------------------------------------------------------
 */

#include "jswrap_font_6x15.h"
#include "jswrap_graphics.h"

// Generated from HaxorNarrow-15.bdf at https://github.com/Tecate/bitmap-fonts with tweaks by Gordon for ISO8859-1
// -ucw.cz-Haxor-Narrow-R-Normal--15-120-72-72-M-72-iso8859-1// BOUNDINGBOX 14 17 -1 -3// _ASCENT 13// _DESCENT 3
// Charset iso8859


static const unsigned char fontBitmap[] = { 
0, 0, 0, 0, 0, 0, 0, 15, 230, 0, 0, 36, 0, 112, 0, 0, 
1, 32, 3, 128, 0, 0, 0, 16, 1, 60, 3, 192, 60, 240, 15, 0, 
242, 0, 32, 0, 0, 3, 136, 8, 136, 17, 16, 127, 240, 68, 64, 136, 
128, 142, 0, 0, 6, 6, 18, 16, 36, 192, 50, 96, 25, 32, 66, 67, 
3, 0, 0, 0, 60, 14, 132, 34, 8, 70, 16, 115, 32, 1, 128, 30, 
128, 0, 9, 0, 28, 0, 0, 0, 7, 192, 48, 96, 128, 34, 0, 32, 
0, 8, 0, 136, 2, 12, 24, 7, 192, 0, 0, 36, 0, 48, 1, 248, 
0, 192, 2, 64, 0, 0, 2, 0, 4, 0, 8, 0, 254, 0, 32, 0, 
64, 0, 128, 0, 0, 0, 72, 0, 224, 0, 0, 16, 0, 32, 0, 64, 
0, 128, 1, 0, 0, 0, 0, 96, 0, 192, 0, 0, 1, 0, 12, 0, 
96, 3, 0, 24, 0, 192, 0, 0, 0, 254, 2, 2, 8, 98, 17, 132, 
16, 16, 31, 192, 0, 0, 64, 1, 0, 4, 0, 15, 254, 0, 0, 16, 
56, 65, 144, 132, 33, 16, 65, 192, 128, 0, 4, 4, 16, 4, 33, 8, 
66, 16, 123, 192, 0, 0, 12, 0, 104, 1, 16, 12, 32, 63, 248, 0, 
128, 0, 1, 240, 130, 32, 132, 65, 8, 130, 16, 248, 0, 0, 63, 224, 
136, 33, 16, 66, 32, 130, 62, 0, 0, 16, 0, 32, 120, 67, 0, 152, 
1, 192, 0, 0, 3, 222, 8, 66, 16, 132, 33, 8, 61, 224, 0, 0, 
240, 130, 16, 132, 33, 8, 66, 15, 248, 0, 0, 24, 96, 48, 192, 0, 
0, 194, 129, 134, 0, 0, 0, 128, 2, 128, 8, 128, 32, 128, 128, 128, 
0, 0, 136, 1, 16, 2, 32, 4, 64, 8, 128, 17, 0, 0, 1, 1, 
1, 4, 1, 16, 1, 64, 1, 0, 0, 0, 64, 1, 0, 2, 9, 132, 
32, 8, 128, 14, 0, 0, 0, 63, 224, 128, 33, 28, 66, 68, 132, 137, 
7, 240, 0, 0, 7, 248, 49, 0, 130, 0, 196, 0, 127, 128, 0, 15, 
254, 16, 132, 33, 8, 66, 16, 123, 192, 0, 1, 255, 4, 1, 8, 2, 
16, 4, 16, 16, 0, 0, 255, 225, 0, 66, 0, 130, 2, 3, 248, 0, 
0, 63, 248, 66, 16, 132, 33, 8, 66, 0, 128, 0, 15, 254, 17, 0, 
34, 0, 68, 0, 128, 0, 0, 1, 255, 4, 1, 8, 2, 16, 132, 17, 
240, 0, 0, 255, 224, 8, 0, 16, 0, 32, 15, 254, 0, 0, 32, 8, 
127, 240, 128, 32, 0, 2, 3, 4, 1, 8, 2, 16, 4, 63, 240, 0, 
0, 255, 224, 8, 0, 40, 1, 140, 12, 6, 0, 0, 63, 248, 0, 16, 
0, 32, 0, 64, 0, 128, 0, 15, 254, 12, 0, 6, 0, 48, 0, 255, 
224, 0, 3, 255, 131, 0, 1, 128, 0, 192, 63, 248, 0, 0, 127, 193, 
0, 66, 0, 132, 1, 7, 252, 0, 0, 63, 248, 66, 0, 132, 1, 8, 
1, 224, 0, 0, 7, 252, 16, 4, 32, 40, 64, 32, 127, 160, 0, 3, 
255, 132, 32, 8, 64, 16, 224, 30, 56, 0, 0, 112, 65, 16, 66, 16, 
132, 17, 4, 28, 0, 0, 32, 0, 64, 0, 255, 225, 0, 2, 0, 0, 
0, 15, 252, 0, 4, 0, 8, 0, 16, 255, 192, 0, 3, 224, 0, 60, 
0, 6, 0, 240, 62, 0, 0, 0, 255, 128, 0, 192, 6, 0, 48, 0, 
24, 0, 12, 63, 224, 0, 0, 192, 224, 102, 0, 48, 1, 152, 12, 14, 
0, 0, 56, 0, 12, 0, 7, 224, 48, 3, 128, 0, 0, 8, 6, 16, 
52, 35, 136, 88, 16, 192, 32, 0, 3, 255, 196, 0, 136, 1, 0, 0, 
48, 0, 24, 0, 12, 0, 6, 0, 3, 0, 1, 0, 0, 16, 2, 32, 
4, 127, 248, 0, 0, 32, 1, 128, 4, 0, 6, 0, 2, 0, 0, 0, 
0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 2, 0, 0, 32, 0, 32, 
0, 32, 0, 0, 0, 39, 0, 145, 1, 34, 2, 72, 3, 248, 0, 0, 
255, 224, 16, 128, 64, 128, 129, 0, 252, 0, 0, 3, 240, 8, 16, 16, 
32, 32, 64, 33, 0, 0, 0, 252, 2, 4, 4, 8, 4, 32, 255, 224, 
0, 0, 63, 0, 145, 1, 34, 2, 68, 3, 144, 0, 0, 16, 0, 255, 
194, 64, 4, 128, 9, 0, 0, 0, 3, 172, 8, 164, 17, 72, 34, 144, 
121, 32, 129, 128, 0, 31, 252, 2, 0, 8, 0, 16, 0, 31, 192, 0, 
0, 1, 1, 2, 19, 252, 0, 8, 0, 16, 0, 0, 0, 32, 0, 32, 
0, 65, 0, 147, 254, 0, 0, 127, 240, 1, 0, 6, 0, 50, 0, 131, 
0, 0, 0, 4, 32, 8, 127, 240, 0, 32, 0, 64, 0, 0, 255, 1, 
0, 3, 252, 4, 0, 7, 240, 0, 0, 63, 192, 32, 0, 128, 1, 0, 
1, 252, 0, 0, 7, 224, 16, 32, 32, 64, 64, 128, 126, 0, 0, 3, 
255, 2, 16, 8, 16, 16, 32, 31, 128, 0, 0, 126, 1, 2, 2, 4, 
2, 16, 15, 252, 0, 0, 63, 192, 32, 0, 128, 1, 0, 1, 0, 0, 
0, 6, 32, 18, 32, 36, 64, 68, 128, 70, 0, 0, 2, 0, 63, 240, 
8, 16, 16, 32, 32, 64, 0, 0, 254, 0, 2, 0, 4, 0, 16, 15, 
240, 0, 0, 56, 0, 14, 0, 3, 0, 56, 3, 128, 0, 0, 15, 192, 
0, 96, 7, 0, 1, 128, 252, 0, 0, 3, 12, 1, 32, 1, 128, 4, 
128, 48, 192, 0, 0, 240, 96, 27, 0, 8, 0, 96, 15, 0, 0, 0, 
32, 192, 66, 128, 153, 1, 66, 3, 4, 0, 0, 57, 56, 141, 137, 0, 
16, 0, 7, 255, 0, 0, 16, 1, 35, 98, 57, 56, 0, 0, 8, 0, 
32, 0, 64, 0, 64, 0, 64, 0, 128, 2, 0, 0, 0, 16, 65, 255, 
132, 65, 8, 2, 16, 4, 16, 56, 0, 0, 226, 128, 61, 0, 15, 192, 
244, 14, 40, 0, 0, 24, 0, 72, 0, 144, 0, 192, 0, 0, 5, 192, 
10, 128, 9, 0, 0, 0, 84, 0, 168, 0, 160, 0, 0, 2, 0, 8, 
0, 0, 0, 7, 254, 0, 16, 0, 32, 0, 128, 127, 128, 0, 0, 192, 
1, 128, 0, 0, 36, 0, 248, 0, 16, 0, 0, 3, 128, 8, 128, 14, 
0, 0, 0, 1, 254, 140, 64, 160, 128, 49, 0, 31, 224, 0, 0, 127, 
131, 16, 40, 32, 140, 64, 7, 248, 0, 0, 31, 228, 196, 18, 8, 19, 
16, 1, 254, 0, 0, 135, 250, 49, 2, 130, 8, 196, 0, 127, 128, 0, 
3, 252, 152, 128, 65, 2, 98, 0, 63, 192, 0, 0, 127, 147, 16, 88, 
32, 76, 64, 7, 248, 0, 3, 255, 8, 32, 16, 64, 63, 248, 66, 16, 
132, 32, 0, 1, 255, 4, 1, 40, 3, 80, 5, 16, 16, 0, 0, 31, 
253, 33, 9, 66, 16, 132, 33, 0, 64, 0, 7, 255, 8, 66, 80, 133, 
33, 8, 64, 16, 0, 1, 255, 202, 16, 164, 33, 40, 66, 16, 4, 0, 
0, 255, 229, 8, 66, 16, 148, 33, 8, 2, 0, 0, 144, 4, 191, 248, 
64, 16, 0, 1, 0, 75, 255, 164, 1, 0, 0, 80, 5, 63, 249, 64, 
16, 0, 10, 0, 135, 255, 40, 2, 0, 0, 255, 225, 8, 66, 16, 130, 
2, 3, 248, 0, 0, 23, 255, 70, 0, 67, 1, 1, 128, 127, 240, 0, 
0, 255, 146, 0, 148, 1, 8, 2, 15, 248, 0, 0, 63, 224, 128, 37, 
0, 82, 0, 131, 254, 0, 0, 15, 248, 160, 10, 64, 18, 128, 32, 255, 
128, 0, 3, 254, 40, 2, 144, 4, 160, 10, 63, 224, 0, 1, 255, 20, 
1, 8, 2, 80, 4, 31, 240, 0, 1, 8, 1, 32, 1, 128, 3, 0, 
9, 0, 33, 0, 0, 0, 127, 193, 7, 2, 114, 7, 4, 31, 240, 0, 
0, 15, 252, 64, 5, 64, 9, 0, 16, 255, 192, 0, 3, 255, 0, 1, 
32, 2, 128, 4, 63, 240, 0, 0, 255, 196, 0, 80, 0, 144, 1, 79, 
252, 0, 0, 127, 226, 0, 32, 0, 72, 0, 135, 254, 0, 0, 14, 0, 
3, 0, 129, 250, 12, 0, 224, 0, 0, 31, 255, 8, 16, 16, 32, 32, 
64, 63, 0, 0, 3, 255, 8, 0, 17, 4, 34, 8, 58, 16, 3, 192, 
0, 0, 39, 4, 145, 5, 34, 2, 72, 3, 248, 0, 0, 9, 192, 36, 
65, 72, 132, 146, 0, 254, 0, 0, 2, 112, 41, 16, 146, 32, 164, 128, 
63, 128, 0, 4, 156, 18, 68, 20, 136, 73, 32, 15, 224, 0, 0, 39, 
2, 145, 1, 34, 10, 72, 3, 248, 0, 0, 4, 224, 146, 34, 164, 66, 
73, 0, 127, 0, 0, 2, 112, 9, 16, 18, 32, 31, 128, 72, 128, 145, 
0, 228, 0, 0, 3, 240, 8, 18, 16, 56, 32, 64, 33, 0, 0, 0, 
252, 18, 68, 20, 136, 9, 16, 14, 64, 0, 0, 63, 0, 145, 5, 34, 
18, 68, 3, 144, 0, 0, 15, 192, 164, 66, 72, 130, 145, 0, 228, 0, 
0, 3, 240, 41, 16, 18, 32, 164, 64, 57, 0, 0, 0, 2, 18, 4, 
23, 248, 0, 16, 0, 32, 0, 0, 0, 128, 129, 5, 254, 16, 4, 0, 
8, 0, 0, 0, 32, 160, 66, 127, 130, 1, 0, 2, 0, 0, 0, 8, 
40, 16, 31, 224, 128, 64, 0, 128, 0, 0, 126, 21, 2, 42, 4, 52, 
8, 95, 224, 0, 1, 127, 132, 64, 5, 0, 18, 0, 3, 248, 0, 0, 
15, 193, 32, 66, 64, 130, 129, 0, 252, 0, 0, 3, 240, 8, 16, 80, 
33, 32, 64, 63, 0, 0, 0, 252, 10, 4, 36, 8, 40, 16, 15, 192, 
0, 0, 63, 2, 129, 9, 2, 10, 4, 35, 240, 0, 0, 15, 192, 160, 
64, 64, 130, 129, 0, 252, 0, 0, 1, 0, 2, 0, 53, 128, 107, 0, 
16, 0, 32, 0, 0, 0, 4, 1, 240, 4, 80, 9, 32, 20, 64, 31, 
0, 64, 0, 0, 3, 248, 32, 8, 32, 16, 0, 64, 63, 192, 0, 0, 
254, 0, 2, 8, 4, 32, 16, 15, 240, 0, 0, 63, 129, 0, 132, 1, 
4, 4, 3, 252, 0, 0, 15, 224, 64, 32, 0, 65, 1, 0, 255, 0, 
0, 3, 193, 128, 108, 32, 32, 129, 128, 60, 0, 0, 7, 255, 1, 16, 
2, 32, 3, 128, 0, 0, 30, 12, 131, 96, 1, 2, 12, 1, 224, 0, 
0, 0, 
};

static const unsigned char fontWidths[] = { 
3, 2, 6, 8, 8, 8, 8, 3, 5, 5, 6, 8, 3, 6, 3, 7, 
7, 5, 6, 6, 7, 6, 6, 6, 6, 6, 3, 3, 6, 7, 6, 7, 
7, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6, 6, 6, 6, 
6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 4, 7, 4, 6, 7, 
4, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 2, 4, 8, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 7, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
5, 0, 4, 4, 3, 6, 0, 3, 0, 4, 4, 0, 0, 0, 0, 0, 
6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 4, 4, 4, 4, 
6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 7, 
6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 
6, 6, 6, 6, 6, 6, 6, 7, 8, 6, 6, 6, 6, 6, 5, 6, 

};


/*JSON{
  "type" : "method",
  "class" : "Graphics",
  "name" : "setFont6x15",
  "generate" : "jswrap_graphics_setFont6x15",
  "params" : [
    ["scale","int","(optional) If >1 the font will be scaled up by that amount"]
  ],
  "return" : ["JsVar","The instance of Graphics this was called on, to allow call chaining"],
  "return_object" : "Graphics"
}
Set the current font
*/
JsVar *jswrap_graphics_setFont6x15(JsVar *parent, int scale) {
  if (scale<1) scale=1;
  JsVar *bitmap = jsvNewNativeString(fontBitmap, sizeof(fontBitmap));
  JsVar *widths = jsvNewNativeString(fontWidths, sizeof(fontWidths));
  JsVar *r = jswrap_graphics_setFontCustom(parent, bitmap, 32, widths, 15 + (scale<<8)); // 1 bit
  jsvUnLock2(bitmap, widths);
  return r;
}
